package cn.humaohua.study.yanmo_design_pattern.ch24.v2;

/**
 * Created by hmh on 09/01/2018.
 */
public class Main {
    public static void main(String[] args) {
        String message = "have a cup of tea";
        String toUser = "xiaoli";

        //创建具体的实现对象
        MessageImplementor impl = new MessageSMS();

        //创建一个普通消息
        AbstractMessage m = new CommonMessage(impl);
        m.sendMessage(message, toUser);

        //创建一个紧急消息
        m = new UrgencyMessage(impl);
        m.sendMessage(message, toUser);

        //创建一个特急消息
        m = new SpecialUrgencyMessage(impl);
        m.sendMessage(message, toUser);

        //把实现方式换成手机短信,然后再实现一遍
        impl = new MessageMobile();

        m = new CommonMessage(impl);
        m.sendMessage(message, toUser);

        m = new UrgencyMessage(impl);
        m.sendMessage(message, toUser);

        m = new SpecialUrgencyMessage(impl);
        m.sendMessage(message, toUser);


    }
}
